package tspda

import glory.xxd.Utils
import tsCIM.ResultCode
import tsCIM.modelForInterface.Header
import tsCIM.modelForInterface.RequestModel
import tsCIM.modelForInterface.ResultModel
import tsCIM.modelForInterface.Return

class PDAEQPInfoRequestController {


    def commentService
    def index() {
        def result = ResultModel.getResultModel()
        try {
            def USERNAME = params.USERNAME?:""
            def EQPID = params.EQPID?:""
            def MACHINENAME = params.MACHINENAME?:""
            print MACHINENAME
            def LOTID = params.LOTID?:""
            def body = [USERNAME:USERNAME,EQPID:EQPID,LOTID:LOTID]
            Header header = new Header(TRANSACTIONID:Utils.getUUID(),MESSAGENAME:"PDAEQPInfoRequest",MACHINENAME:MACHINENAME)
            Return aReturn = new Return()
            RequestModel requestModel = new RequestModel(header: header,body: body,aReturn: aReturn)
//            result = commentService.getJsonByTopic2Queue(requestModel,"sendmqname","returnmqname",true,responseXml)
            result = commentService.getJsonByTopic2Queue(requestModel,"jms.topic.PDA.TO.CIM","jms.queue.CIM.PDA.Send",false,false)
        }catch (Exception e){
            result.put(ResultModel.ServerErrorFlag,true)
            result.put(ResultModel.Code,ResultCode.SERVER_INTERFACE_ERROR.code)
            result.put(ResultModel.Msg,ResultCode.SERVER_INTERFACE_ERROR.msg)
            result.put(ResultModel.Data,e.getMessage())
        }finally{
            render Utils.getFormatString(result)
        }
    }

    def responseXml = """
  <MESSAGE>
<HEADER>
  <TRANSACTIONID>b8fd185c-2b19-43ab-a9fb-d9c69fb81455</TRANSACTIONID>
  <MESSAGENAME>PDAEQPInfoResponse</MESSAGENAME>
  <MACHINENAME>WM-2112</MACHINENAME>
  <WORKNO>1</WORKNO>
  <EVENTUSER>CIM</EVENTUSER>
  <EVENTTIME>2019-03-16 23:38:42.468</EVENTTIME>
</HEADER>
<BODY>
   <EQPMATERIALLIST>
    <MATERIALPROP>
      <MATERIALTYPE>MoldingCompound</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>InjectionHeadAndBarrel</MATERIALTYPE>
      <MACHINED_DIE_NUMBER>值</MACHINED_DIE_NUMBER>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Punch</MATERIALTYPE>
      <MACHINED_DIE_NUMBER>值</MACHINED_DIE_NUMBER>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>WeldingWire</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
      <SUPPLIER>值</SUPPLIER>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Cleaver</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Fixture</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Epoxy</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <THAWING_END_TIME>value</THAWING_END_TIME>
      <THAWING_START_TIME>value</THAWING_START_TIME>
      <EXPIRATION_TIME>值</EXPIRATION_TIME>
      <BATCH_NO>value</BATCH_NO>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>LF</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
      <BATCH_NO>value</BATCH_NO>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>SuctionNozzle</MATERIALTYPE>
      <MATERIALSIZE>值</MATERIALSIZE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Thimble</MATERIALTYPE>
      <MATERIALSIZE>值</MATERIALSIZE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>AdhesiveFilm</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <BATCH_NO>值</BATCH_NO>
      <THICKNESS>值</THICKNESS>
      <PERIOD_VALIDITY>value</PERIOD_VALIDITY>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>DicingKnifeZ1</MATERIALTYPE>
      <MATERIALMODEL>value</MATERIALMODEL>
      <THICKNESS>value</THICKNESS>
      <BLADE_NO>值</BLADE_NO>
      <BLADE_BORE>值</BLADE_BORE>
      <BLADE_OD>值</BLADE_OD>
      <EXPOSURE_DOSE>value</EXPOSURE_DOSE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>DicingKnifeZ2</MATERIALTYPE>
      <MATERIALMODEL>value</MATERIALMODEL>
      <THICKNESS>value</THICKNESS>
      <BLADE_NO>值</BLADE_NO>
      <BLADE_BORE>值</BLADE_BORE>
      <BLADE_OD>值</BLADE_OD>
      <EXPOSURE_DOSE>value</EXPOSURE_DOSE>
      <NUMBER>xx</NUMBER>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>GrindingWheel</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <BATCH_NO>值</BATCH_NO>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>ThinnerAdhesiveFilm</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
      <BATCH_NO>值</BATCH_NO>
      <THICKNESS>值</THICKNESS>
      <PERIOD_VALIDITY>value</PERIOD_VALIDITY>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Insert</MATERIALTYPE>
      <MACHINED_DIE_NUMBER>值</MACHINED_DIE_NUMBER>
    </MATERIALPROP>
  </EQPMATERIALLIST>
  <LOTINFO>
     <MATERIALPROPLIST>
      <MATERIALPROP>
        <MATERIALTYPE>MoldingCompound</MATERIALTYPE>
        <MATERIALMODEL>值</MATERIALMODEL>
        <MATERIALSIZE>值</MATERIALSIZE>
      </MATERIALPROP>
      <MATERIALPROP>
      <MATERIALTYPE>InjectionHeadAndBarrel</MATERIALTYPE>
      <MACHINED_DIE_NUMBER>值</MACHINED_DIE_NUMBER>
      </MATERIALPROP>
      <MATERIALPROP>
      <MATERIALTYPE>Punch</MATERIALTYPE>
      <MACHINED_DIE_NUMBER>值</MACHINED_DIE_NUMBER>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>WeldingWire</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
      <SUPPLIER>值</SUPPLIER>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Cleaver</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Fixture</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Epoxy</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <THAWING_END_TIME>value</THAWING_END_TIME>
      <THAWING_START_TIME>value</THAWING_START_TIME>
      <EXPIRATION_TIME>值</EXPIRATION_TIME>
      <BATCH_NO>value</BATCH_NO>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>LF</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
      <BATCH_NO>value</BATCH_NO>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>SuctionNozzle</MATERIALTYPE>
      <MATERIALSIZE>值</MATERIALSIZE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Thimble</MATERIALTYPE>
      <MATERIALSIZE>值</MATERIALSIZE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>AdhesiveFilm</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <BATCH_NO>值</BATCH_NO>
      <THICKNESS>值</THICKNESS>
      <PERIOD_VALIDITY>value</PERIOD_VALIDITY>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>DicingKnifeZ1</MATERIALTYPE>
      <MATERIALMODEL>value</MATERIALMODEL>
      <THICKNESS>value</THICKNESS>
      <BLADE_NO>值</BLADE_NO>
      <BLADE_BORE>值</BLADE_BORE>
      <BLADE_OD>值</BLADE_OD>
      <EXPOSURE_DOSE>value</EXPOSURE_DOSE>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>DicingKnifeZ2</MATERIALTYPE>
      <MATERIALMODEL>value</MATERIALMODEL>
      <THICKNESS>value</THICKNESS>
      <BLADE_NO>值</BLADE_NO>
      <BLADE_BORE>值</BLADE_BORE>
      <BLADE_OD>值</BLADE_OD>
      <EXPOSURE_DOSE>value</EXPOSURE_DOSE>
      <NUMBER>xx</NUMBER>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>GrindingWheel</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <BATCH_NO>值</BATCH_NO>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>ThinnerAdhesiveFilm</MATERIALTYPE>
      <MATERIALMODEL>值</MATERIALMODEL>
      <MATERIALSIZE>值</MATERIALSIZE>
      <BATCH_NO>值</BATCH_NO>
      <THICKNESS>值</THICKNESS>
      <PERIOD_VALIDITY>value</PERIOD_VALIDITY>
    </MATERIALPROP>
    <MATERIALPROP>
      <MATERIALTYPE>Insert</MATERIALTYPE>
      <MACHINED_DIE_NUMBER>值</MACHINED_DIE_NUMBER>
    </MATERIALPROP>
  </MATERIALPROPLIST>
    <EQPID>DB-447</EQPID>
    <LOTID>32323232</LOTID>
    <CARRIER>xxx</CARRIER>
    <CURRENTSTEP>减薄</CURRENTSTEP>
    <RECIPEID>123456qwe</RECIPEID>
    <RECIPENO>ssss/1111</RECIPENO>
    <WAFERSOURCE>12222wwww</WAFERSOURCE>
    <WAFERSOURCEVERSION>1.3</WAFERSOURCEVERSION>
    <DIAGRAM>88A22222L</DIAGRAM>
    <DIAGRAMVERSION>1</DIAGRAMVERSION>
    <PACKAGINGFORM>ASDF</PACKAGINGFORM>
    <CUSTOMERCODE>11111111</CUSTOMERCODE>
    <PRODUCTMODEL>qwert</PRODUCTMODEL>
    <DIEMODEL>222222222</DIEMODEL>
    <WAFERNO>xx22222</WAFERNO>
    <DIESIZE>2.2</DIESIZE>
    <INITIALTHICKNESS>2.5</INITIALTHICKNESS>
    <WAFERSIZE>1.3</WAFERSIZE>
    <WAFERCONTROLCARDTYPE>CDAF</WAFERCONTROLCARDTYPE>
    <FINALTHICKNESS>2.3</FINALTHICKNESS>
    <COATINGTHICKNESS>1.2</COATINGTHICKNESS>
    <WAFERDIAMETER>2</WAFERDIAMETER>
    <WAFERTHICKNESS>2.4</WAFERTHICKNESS>
    <ISLBG>true</ISLBG>
    <LEADFRAME>XXXXXXXX</LEADFRAME>
    <TABLETS>0</TABLETS>
    <DONETABLETS>0</DONETABLETS>
    <DONEQTY>1000</DONEQTY>
    <WORKORDERQTY>10</WORKORDERQTY>
    <ISPROCESSSTART>false</ISPROCESSSTART>
    <PROCESSSTATUS>Local</PROCESSSTATUS>
    <OPID>IE05</OPID>
    <LOTSTATUS>IDEL</LOTSTATUS>
    <ISSTATUS>N</ISSTATUS>
  </LOTINFO>
  <EQPSTATUS>IDEL</EQPSTATUS>
</BODY>
<RETURN>
  <RETURNCODE />
  <RETURNMESSAGE />
</RETURN>
</MESSAGE>
    """
}